<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@page isELIgnored="false" %>
<html>
<head>
    <title>个人中心</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <!--css文件-->
    <jsp:include page="common/common-css.jsp" />
</head>
<body>

<jsp:include page="common/common-mobileButton.jsp" />

<div class="main-wrapper">
    <!--页面导航栏组件-->
    <jsp:include page="common/common-header.jsp" />


    <main class="main-content">
        <div class="faq-area section-space-y-axis-100">
            <div class="container">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="frequently-area">
                            <h2 class="heading mb-0">个人信息</h2>

                            <div align="center">
                                <!--提示消息-->
                                <c:if test="${!empty msg}">
                                    <div class="alert alert-success"> ${msg}</div>
                                </c:if>

                                <c:if test="${!empty failMsg}">
                                    <div class="alert alert-danger">${failMsg}</div>
                                </c:if>
                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="row">
                                        <div class="col-lg-12">
                                            <div class="frequently-item">
                                                <ul>
                                                    <li class="has-sub active open">
                                                        <a>收货信息
                                                            <i class="pe-7s-angle-down"></i>
                                                        </a>
                                                        <ul class="frequently-body" style="display: block;">
                                                            <li>
                                                                <form id="infoForm" action="/bookmall/user/info"
                                                                      method="post"
                                                                      onsubmit="return validateUserInfo()">
                                                                    <input type="hidden" name="id"
                                                                           value="${usered.id}" />

                                                                    <div id="realNameDiv"
                                                                         class="form-group row has-warning"
                                                                         style="height: 60px;">
                                                                        <label class="col-sm-2 control-label"><i>*</i>收货人</label>
                                                                        <div class=" col-sm-5">
                                                                            <input type="text" name="realName"
                                                                                   value="${usered.realName}"
                                                                                   class="form-control"
                                                                                   placeholder="请输入真实姓名"
                                                                                   required="required" autocomplete="off" data-tippy="由汉字组成，长度2-4位" />
                                                                        </div>
                                                                    </div>

                                                                    <div id="phoneDiv"
                                                                         class="form-group row has-warning"
                                                                         style="height: 60px;">
                                                                        <label class="col-sm-2 control-label"><i>*</i>手机号</label>
                                                                        <div class="col-sm-5">
                                                                            <input type="text" name="phone"
                                                                                   value="${usered.phone}"
                                                                                   class="form-control"
                                                                                   placeholder="请输入可用手机号"
                                                                                   required="required" data-tippy="11位数可用手机号" autocomplete="off" />
                                                                        </div>
                                                                    </div>

                                                                    <div id="addressDiv"
                                                                         class="form-group row has-warning"
                                                                         style="height: 60px;">
                                                                        <label class="col-sm-2 control-label"><i>*</i>收货地址</label>
                                                                        <div class="col-sm-8">
                                                                        <textarea name="address" id="address" autocomplete="off"
                                                                                  class="form-control" rows="2"
                                                                                  style="width: 420px;" data-tippy="只能包含有汉字、数字，且长度至少为12">${usered.address}</textarea>
                                                                        </div>
                                                                    </div>

                                                                    <br />
                                                                    <div class="contact-button-wrap">
                                                                        <button type="submit"
                                                                                class="btn btn btn-custom-size btn-pronia-primary">
                                                                            确认
                                                                        </button>
                                                                    </div>
                                                                </form>
                                                            </li>
                                                        </ul>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>


                                <div class="col-md-6 pt-30 pt-md-0">
                                    <div class="row">
                                        <div class="col-lg-12">
                                            <div class="frequently-item">
                                                <ul>
                                                    <li class="has-sub active open">
                                                        <a>修改密码
                                                            <i class="pe-7s-angle-down"></i>
                                                        </a>
                                                        <ul class="frequently-body" style="display: block;">
                                                            <li>
                                                                <form action="/bookmall/user/safe" method="post" onsubmit="return validatePassword()">
                                                                    <input type="hidden" name="id" value="${usered.id}" />
                                                                    <div id="pwdDiv" class="form-group row has-warning" style="height: 60px;">
                                                                        <label class="col-sm-2 control-label"><i>*</i>原密码</label>
                                                                        <div class="col-sm-6">
                                                                            <input type="password" name="oldpassword" class="form-control"
                                                                                   placeholder="请输入原密码"
                                                                                   required="required" />
                                                                        </div>
                                                                    </div>

                                                                    <div style="height: 60px;"></div>

                                                                    <div id="repwdDiv" class="form-group row has-warning" style="height: 60px;">
                                                                        <label class="col-sm-2 control-label"><i>*</i>新密码</label>
                                                                        <div class="col-sm-6">
                                                                            <input type="password" name="newpassword" class="form-control"
                                                                                   placeholder="请输入新密码"
                                                                                   required="required" />
                                                                        </div>
                                                                    </div>

                                                                    <br />
                                                                    <div class="contact-button-wrap">
                                                                        <button type="submit"
                                                                                class="btn btn btn-custom-size btn-pronia-primary">
                                                                            确定
                                                                        </button>
                                                                    </div>
                                                                </form>
                                                            </li>
                                                        </ul>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>
    <!--页尾-->
    <jsp:include page="footer.jsp" />
</div>
<!--js文件-->
<jsp:include page="common/common-js.jsp" />
<script>
    $(function () {
        //禁用“确认重新提交表单”
        window.history.replaceState(null, null, window.location.href);
    })
</script>
</body>
</html>
